// index page
// ============

define(['require', 'zepto', 'wx', 'qrcode', 'utils', 'sui'], function(require, $, wx, QRCodeJs, utils) {
  return {
    init : function(data) {
      var url = window.__CTX__.domain + '/users/'+data.userId+'/bets/'+data.betId;
      var qrcode = new QRCode("qrcode", {
        width: 100,
        height: 100,
        colorDark : "#000000",
        colorLight : "#ffffff",
        correctLevel : QRCode.CorrectLevel.H
      });
      qrcode.clear();
      qrcode.makeCode(url);
      
      var name = data.userName ? data.userName + "28天减重5%，敢不敢跟我赌？" : "【赌你会瘦】28天减重5%，敢不敢跟我赌？";
      var desc = "信或不信，巨额奖金都在那里，等你来瓜分！"
      utils.configWeixin(data.jsConfig, true, {
        name: name,
        desc: desc,
        link: url + "/share",
        cover : data.avatar
      });
    }
  }
})